home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr27 / fm2utls2.zip / CVT4OS2.CMD < prev    next >
OS/2 REXX Batch file  |  1994-09-24  |  2KB  |  49 lines

  1. /* Convert DESCRIPT.ION files to WPS .SUBJECT EAs    */
  2. /* I'm not terribly familiar with 4OS2 so this might */
  3. /* not cover unusual situations (for instance, I'm   */
  4. /* guessing the format is "filename.ext description" */
  5. /* and don't try to handle filenames with embedded   */
  6. /* spaces since I don't know how they're handled in  */
  7. /* the file (quote delimited?).  Modify to taste.    */
  8. /* As written, DESCRIPT.ION file must be in the      */
  9. /* default directory and will be deleted when done.  */
  10. /* Also note that I'm told that 4OS2 has commands    */
  11. /* that allow it to retrieve the file description    */
  12. /* for you -- it might be best to use those instead  */
  13. /* of reading the DESCRIPT.ION file directly.        */
  14.  
  15. '@echo off'
  16. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  17. call SysLoadFuncs
  18. rc = SysFileTree('DESCRIPT.ION','dummy','F','*****','**---')
  19. describename = stream('DESCRIPT.ION','C','query exists')
  20. if describename \= '' then
  21. do
  22.   destream = stream(describename,'C','open')
  23.   if destream = "READY:" then
  24.   do
  25.     say 'Working...'
  26.     do while lines(describename)
  27.       text = linein(describename)
  28.       parse var text filename text
  29.       text = left(text,40)
  30.       text = strip(text)
  31.       filename = strip(filename)
  32.       if filename \= '' then
  33.         if text \= '' then
  34.         do
  35.           description = 'FDFF'x || d2c(length(text)) || '00'x || text
  36.           call SysPutEA filename,'.SUBJECT',description
  37.         end
  38.     end
  39.     call stream describename,'C','close'
  40.  
  41.     /* done; delete file.  remove next line if that's not what you want. */
  42.     'del 'describename
  43.  
  44.   end
  45. end
  46. else
  47.   say 'File DESCRIPT.ION not found in current directory.'
  48. exit
  49.